<?php

declare(strict_types=1);

namespace app\model;

use think\model\Pivot;
use think\model\concern\SoftDelete;

class AuthUserRole extends Pivot
{
    use SoftDelete;

    protected $name = 'auth_user_role';

    protected $autoWriteTimestamp = 'datetime';

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function role()
    {
        return $this->belongsTo(AuthRole::class, 'role_id');
    }

    public function org()
    {
        return $this->belongsTo(Org::class, 'org_id');
    }

    public function region()
    {
        return $this->belongsTo(Region::class, 'region_id');
    }
}
